package com.igeek.clud_system.controller;

import com.igeek.clud_system.common.Const;
import com.igeek.clud_system.entity.ClubMembers;
import com.igeek.clud_system.entity.Student;
import com.igeek.clud_system.service.ClubAttentionService;
import com.igeek.clud_system.service.StudentService;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ClubAttentionController {
    @Autowired
    private ClubAttentionService clubAttentionService;
    @Autowired
    private StudentService studentService;
    @GetMapping("role/{clubId}")
    public ClubMembers role(HttpSession session,@PathVariable("clubId") Integer clubId){
        System.out.println("进入角色");
        Student student=(Student) session.getAttribute(Const.LOGIN_USER);
        ClubMembers role = studentService.findRole(clubId, student.getStudentId());
        System.out.println("role:"+role);
        return role;
    }
}
